package util

import (
	"crypto/md5"
	"encoding/base64"
	"ordersystem/config"
)

func DoubleMd5Salt(resource string) string {
	resource += config.DOUBLEMD5_FIRST_SALT
	data := []byte(resource)
	has := md5.Sum(data)
	newStringBySalt := string(has[:]) + config.DOUBLEMD5_SECOND_SALT
	cryptoByte := md5.Sum([]byte(newStringBySalt))
	return base64.RawURLEncoding.EncodeToString(cryptoByte[:])
}
